﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SvOtchet.servcontrols
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:AlertControl runat=server></{0}:AlertControl>")]
    public class AlertControl : WebControl
    {
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        string text = "";
        public string Text
        {
            get
            {
                return text;
            }

            set
            {
                text = value;
            }
        }

        protected override void RenderContents(HtmlTextWriter output)
        {
            
            if (Text.Length > 0)
            {
                string message = string.Format(@"<script>alert('{0}');</script>",Text);
                output.Write(message);
            }
            
        }
    }
}
